{extend name="public/base" /}
 {block name="body"}
<div class="content-tabs">
	<ol class="breadcrumb">
		<li>
			<a href="{:url('admin/index/index')}"><i class="fa fa-home"></i></a>
		</li>
		<li>
			<a href="{:url('index')}">微信菜单</a>
		</li>
		<li><strong>添加微信菜单</strong></li>
	</ol>
</div>
<div class="row">
	<div class="col-sm-12">
		<div class="ibox float-e-margins">
			<div class="ibox-content">
				<form id="myForm" class="form-horizontal m-t" method="post" action="{:url('add')}">
					<div class="form-group">
						<label class="col-sm-3 control-label">上级菜单：</label>
						<div class="input-group col-sm-4">
							<select name="pid" class="form-control">
								<option value="0">一级菜单</option>
								{foreach name="list" item="vo"}
								<option value="{$vo.id}" {if $pid==$vo.id} selected="selected" {/if}>
									{$vo.name}
								</option>
								{/foreach}
							</select>
						</div>
					</div>
					<div class="hr-line-dashed"></div>
					
					<div class="form-group">
						<label class="col-sm-3 control-label">菜单名称：</label>
						<div class="input-group col-sm-4">
							<input type="text" id="name" name="name" placeholder="菜单名称" class="form-control" />
						</div>
					</div>
					<div class="hr-line-dashed"></div>
					<div class="form-group">
						<label class="col-sm-3 control-label">菜单类型：</label>
						<div class="input-group col-sm-4">
							<select name="type" class="form-control">
								<option value="click">点击事件</option>
								<option value="view">跳转URL</option>
							</select>
						</div>
					</div>
					<div class="hr-line-dashed"></div>
					<div class="form-group">
						<label class="col-sm-3 control-label">菜单值：</label>
						<div class="input-group col-sm-4">
							<input type="text" id="val" name="val" placeholder="菜单值" class="form-control" />
						</div>
					</div>
					<div class="hr-line-dashed"></div>
					<div class="form-group">
						<label class="col-sm-3 control-label">排序：</label>
						<div class="input-group col-sm-4">
							<input type="text" id="sort" name="sort" value="0" class="form-control" />
						</div>
					</div>
					<div class="hr-line-dashed"></div>
					<div class="form-group">
						<div class="col-sm-4 col-sm-offset-3">
							<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 保存</button>&nbsp;&nbsp;
							<a href="{:url('index')}" class="btn btn-danger"><i class="fa fa-arrow-left"></i> 返回 </a>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
{/block} {block name="script"}
<script src="__LIB__/validate/jquery.validate.min.js"></script>
<script src="__LIB__/validate/messages_zh.min.js"></script>
<script src="__LIB__/validate/add_validate.min.js"></script>
<script>
	$(function() {
		$("#myForm").validate({
			rules: {
				name: "required",
				val: "required"
			},
			messages: {
				name: ICON.error + "请输入菜单名",
				val: ICON.error + "请输入菜单值"
			},
			submitHandler: function(form) {
				ajaxForm();
			}
		});
	});
</script>
{/block}